package com.example.webdemo.controller;

import com.example.webdemo.dao.UserJpaRepository;
import com.example.webdemo.entity.UserJpa;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class JpaController {
    @Autowired
    private UserJpaRepository userJpaRepository;
    @RequestMapping("/addUserJpa")
    public String addUserJpa(){
        UserJpa user = new UserJpa();
        user.setName("test");
        userJpaRepository.saveAndFlush(user);
        return "success";
    }
}
